<?php
declare (strict_types = 1);

namespace app\middleware;


/**
 * 示例-中间件
 * Class DemoMiddleware
 *
 * // 定义中间件
 * php think make:middleware DemoMiddleware
 *
 * @package app\middleware
 * @author ^2_3^王尔贝
 */
class DemoMiddleware
{
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {
        //// 前置中间件

        if( $request->param('developer') == 'cyb' ) {
            return redirect('/');
        }

        return $next( $request );
    }
}
